/**
 * Witontek.com.
 * Copyright (c) 2012-2016 All Rights Reserved.
 */
package test.string;

import java.util.ArrayList;
import java.util.List;

import net.sf.json.JSONObject;

/**
 * 
 * @author Long
 * @version $Id: Menu.java, v 0.1 2016年12月14日 下午2:23:03  xiaolong.ma  Exp $
 */
public class Menu {

    public String getMeetingMenuStr(long id) {

        String serverUrl = "{serverUrl}";
        String authUrl = "{wxAuth}"; //"&logtype=xx&appid=" + id;
        JSONObject menu = new JSONObject();
        List<JSONObject> buttons = new ArrayList<JSONObject>();

        JSONObject button_1 = new JSONObject();
        {
            button_1.put("name", "新建会议");
            JSONObject sub_button_1 = new JSONObject();
            {
                sub_button_1.put("type", "view");
                sub_button_1.put("name", "新建会议");
                sub_button_1.put("url", serverUrl + "/wx/qyh/meeting/create?1=1" + authUrl);
            }
            JSONObject sub_button_2 = new JSONObject();
            {
                sub_button_2.put("type", "view");
                sub_button_2.put("name", "会议室状态");
                sub_button_2.put("url", serverUrl + "/wx/qyh/meeting/status?1=1" + authUrl);
            }
            List<JSONObject> sub_buttons = new ArrayList<JSONObject>();
            sub_buttons.add(sub_button_1);
            sub_buttons.add(sub_button_2);
            button_1.put("sub_button", sub_buttons);
        }
        JSONObject button_2 = new JSONObject();
        {
            button_2.put("name", "我发起的");
            JSONObject sub_button_1 = new JSONObject();
            {
                sub_button_1.put("type", "view");
                sub_button_1.put("name", "待进行");
                sub_button_1.put("url",
                    serverUrl + "/wx/qyh/initiated/query.htm?meetingStatus=wait" + authUrl);
            }
            JSONObject sub_button_2 = new JSONObject();
            {
                sub_button_2.put("type", "view");
                sub_button_2.put("name", "进行中");
                sub_button_2.put("url",
                    serverUrl + "/wx/qyh/initiated/query.htm?meetingStatus=running" + authUrl);
            }
            JSONObject sub_button_3 = new JSONObject();
            {
                sub_button_3.put("type", "view");
                sub_button_3.put("name", "已结束");
                sub_button_3.put("url",
                    serverUrl + "/wx/qyh/initiated/query.htm?meetingStatus=end" + authUrl);
            }
            JSONObject sub_button_4 = new JSONObject();
            {
                sub_button_4.put("type", "view");
                sub_button_4.put("name", "已取消");
                sub_button_4.put("url",
                    serverUrl + "/wx/qyh/initiated/query.htm?meetingStatus=cancel" + authUrl);
            }

            List<JSONObject> sub_buttons = new ArrayList<JSONObject>();
            sub_buttons.add(sub_button_1);
            sub_buttons.add(sub_button_2);
            sub_buttons.add(sub_button_3);
            sub_buttons.add(sub_button_4);
            button_2.put("sub_button", sub_buttons);
        }
        JSONObject button_3 = new JSONObject();
        {
            button_3.put("name", "我参与的");
            JSONObject sub_button_1 = new JSONObject();
            {
                sub_button_1.put("type", "view");
                sub_button_1.put("name", "待进行");
                sub_button_1.put("url",
                    serverUrl + "/wx/qyh/myMeeting/query?meetingStatus=wait" + authUrl);
            }
            JSONObject sub_button_2 = new JSONObject();
            {
                sub_button_2.put("type", "view");
                sub_button_2.put("name", "进行中");
                sub_button_2.put("url",
                    serverUrl + "/wx/qyh/myMeeting/query?meetingStatus=running" + authUrl);
            }
            JSONObject sub_button_3 = new JSONObject();
            {
                sub_button_3.put("type", "view");
                sub_button_3.put("name", "已结束");
                sub_button_3.put("url",
                    serverUrl + "/wx/qyh/myMeeting/query?meetingStatus=end" + authUrl);
            }
            JSONObject sub_button_4 = new JSONObject();
            {
                sub_button_4.put("type", "view");
                sub_button_4.put("name", "已取消");
                sub_button_4.put("url",
                    serverUrl + "/wx/qyh/myMeeting/query?meetingStatus=cancel" + authUrl);
            }

            List<JSONObject> sub_buttons = new ArrayList<JSONObject>();
            sub_buttons.add(sub_button_1);
            sub_buttons.add(sub_button_2);
            sub_buttons.add(sub_button_3);
            sub_buttons.add(sub_button_4);
            button_3.put("sub_button", sub_buttons);
        }

        buttons.add(button_1);
        buttons.add(button_2);
        buttons.add(button_3);
        menu.put("button", buttons);

        return menu.toString();

    }

    public String getWeeklyMenuStr(long id) {

        String serverUrl = "{serverUrl}";
        String authUrl = "{wxAuth}"; //"&logtype=xx&appid=" + id;
        JSONObject menu = new JSONObject();
        List<JSONObject> buttons = new ArrayList<JSONObject>();

        JSONObject button_1 = new JSONObject();
        {
            button_1.put("name", "历史周程表");

            button_1.put("type", "view");
            button_1.put("url", serverUrl + "/wx/qyh/meeting/create?1=1" + authUrl);

        }

        buttons.add(button_1);

        menu.put("button", buttons);

        return menu.toString();

    }

    public static void main(String[] args) {
        Menu m = new Menu();
        System.out.println(m.getWeeklyMenuStr(10));

    }
}
